package com.cmdi.mq.controller;

import com.cmdi.mq.domain.AlarmMessage;
import com.cmdi.mq.domain.TeaTeacher;
import com.cmdi.mq.service.TeaTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @Description: java类作用描述
 * @Author: gaozb
 * @Date: 2021/10/9$ 14:06$
 * @Version: 1.0
 */
@RestController
public class TeacherController {
    @Autowired
    private TeaTeacherService teaTeacherService;

    @RequestMapping("/tea/a")
    public void teaa(String name) {
        TeaTeacher entity = new TeaTeacher();
        entity.setTeaname(name);
        entity.setPassword(name);
        entity.setStatus(new Integer(1).byteValue());

        entity.setCreated(new Date());
        teaTeacherService.save(entity);
    }

    @RequestMapping("/sw/alarm")
    public void alarm(@RequestBody List<AlarmMessage> alarms) {
        for (AlarmMessage alarm : alarms) {
            System.out.println(alarm);
        }
    }
}